#!/bin/bash


src_files=(
    ${LITOS_PROJECT_DIR}/bl/main.c \

	${LITOS_PROJECT_DIR}/bl/drivers/device.c \
	${LITOS_PROJECT_DIR}/bl/drivers/ringbuffer.c \
	${LITOS_PROJECT_DIR}/bl/drivers/serial.c \
	${LITOS_PROJECT_DIR}/bl/pilink/pilink.c \
)

set -e

for cfile in ${src_files[*]}
do
	if [ "${cfile##*.}"x = "c"x ];then
		filename=${cfile##*/}
		echo "CC ${filename}.c -o ${filename}.o"
		${CC} ${CHIP_INCLUDES} ${APP_INCLUDES} ${CFLAGS} -c ${cfile} -o ${LITOS_PROJECT_DIR}/build/${filename}.o
	fi

	if [ "${cfile##*.}"x = "s"x ];then
		filename=${cfile##*/}
		echo "CC ${filename}.s -o ${filename}.o"
		${CC} ${CHIP_INCLUDES} ${APP_INCLUDES} ${ASFLAGS} -c ${cfile} -o ${LITOS_PROJECT_DIR}/build/${filename}.o
	fi
done
